home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.tip.net!dataphone!newsmaster
- From: skorpio@dataphone.se (Jarmo Paavilainen)
- Newsgroups: comp.lang.c++
- Subject: Re: goto command
- Date: 10 Apr 1996 09:27:45 GMT
- Organization: Dataphone Communication Networks
- Message-ID: <4kfuuh$3v8@nic.dataphone.se>
- References: <4k9vne$9lu@nntp.igs.net><4k9vne$9lu@nntp.igs.net> <9604081700.AA001p0@lorelei.demon.co.uk>
- Reply-To: skorpio@dataphone.se
- NNTP-Posting-Host: nikson.dataphone.se
- X-Newsreader: NeoLogic News for OS/2 [version: 4.5 YO Beta]
-
- In message <9604081700.AA001p0@lorelei.demon.co.uk> - John Croudy
- ..
- :>Sounds like you need a while-loop or a for-loop... but not a goto!
- :>
- :>I like to pretend goto doesn't exist!
-
- Why ?! goto is great for jumping out of loops !
-
- ex.
-
- REDO:
- for(i = 0;i<20;i++)
- {
- ...Do something
- while(x != 3)
- {
- ...Do something
- while(y ==4)
- {
- ...Do something
-
- if(t == 8)
- goto DONE;
-
- if(t == 9)
- goto REDO;
-
- ...Do something
- }
- ...Do something
- }
- ...Do something
- }
-
- DONE:
- .. We are done !
-
- Take care,
- Skorpio
- _________________________________________________________________________
- Jarmo Paavilainen, Skorpio skorpio@dataphone.se
-
-